fix: Replace plain SHA-256 with HMAC-SHA256 for remote function artifact integrity#5602
Open
mollyheamazon wants to merge 12 commits intoaws:masterfrom
Open
fix: Replace plain SHA-256 with HMAC-SHA256 for remote function artifact integrity#5602mollyheamazon wants to merge 12 commits intoaws:masterfrom
mollyheamazon wants to merge 12 commits intoaws:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ticket: https://tiny.amazon.com/umah6gic/tcorpamazD403over
Issue
PR #5379 updated the integrity verification for remote function serialized artifacts by switching from HMAC to SHA-256 hashing. However, this approach has a gap
where the hash can be recomputed if the artifact is replaced, making the integrity check ineffective.
Solution
Re-introduce HMAC-SHA256 signing with the key stored in AWS Secrets Manager instead of environment variables (the original approach in pre-#5379). A trust anchor in SSM Parameter Store ensures the key reference cannot be tampered with.
Breaking change
This changes the serialization/deserialization format for remote function artifacts. Existing in-flight jobs will need to be re-run after upgrade.
New IAM permissions required
Execution roles used with @Remote / RemoteExecutor need:
arn:aws:secretsmanager:*:*:secret:sagemaker/remote-function/*Testing
Validated end-to-end via notebook: https://tiny.amazon.com/kyowq0p4/drivcorpamazdocumollremoipyn
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.